package com.soecode.lyf.service.impl;

import java.util.List;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.soecode.lyf.dao.UserDao;
import com.soecode.lyf.entity.User;
import com.soecode.lyf.entity.UserInfo;
import com.soecode.lyf.service.UserService;
@Service
public class UserServiceImpl implements UserService{
	
	private Logger logger = LoggerFactory.getLogger(this.getClass());
	
	@Autowired
	private UserDao userDao;
	// 注册
	@Override
	public int Register(String uuid, String nickname,String password,String imgpath,String username,String birthday,String token,String exp) {
		return userDao.Register(uuid,username, password,nickname,imgpath,birthday,token,exp);
	}
	@Override
	public int QQLogin(UserInfo user) {
		return userDao.QQLogin(user);
	}
	// 注册之前先查询用户是否已经注册
	@Override
	public User SelectUser(String username){
		return userDao.SelectUser(username);
	}
	// 根据userid查询用户信息getUserInfo
	@Override
	public UserInfo getUserInfo(String userid){
		System.out.println("查询用户信息执行了");
		return userDao.getUserInfo(userid);
	}
	// 登录
	@Override
	public UserInfo login(String username, String password) {
		return userDao.login(username,password);
	}
	// 延长token有效期
	@Override
	public int UpdateTokenExp(String username, String password,String exp,String token) {
		return userDao.updateTokenExp(username,password,exp,token);
	}
	// 签到
	@Override
	public int insertSignin(String date,String userid) {
		return userDao.insertSignin(date,userid);
	}
	// 查询今天是否签到
	@Override
	public Map selectIsSign(String userid,String date) {
		return userDao.selectIsSign(userid,date);
	}
	// 查询用户签到列表
	@Override
	public List<User> selectSignDays(String userid){
		return userDao.selectSignDays(userid);
	}
}
